Public Class frmInfo

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim x As System.Windows.Forms.Control

        x = findControl("trackBarGrassSize", NWN2Toolset.NWN2ToolsetMainForm.App.TerrainEditor.Controls)
        Label1.Text = CType(x, System.Windows.Forms.TrackBar).Value.ToString
        CType(x, System.Windows.Forms.TrackBar).Value = 95
    End Sub

    Private Function findControl(ByVal name As String, ByRef controls As System.Windows.Forms.Control.ControlCollection) As System.Windows.Forms.Control
        Dim cur, result As System.Windows.Forms.Control


        For Each cur In controls
            If cur.Name = name Then Return cur
            If cur.HasChildren Then
                result = findControl(name, cur.Controls)
                If Not result Is Nothing Then Return result
            End If
        Next

        Return Nothing
    End Function
End Class